home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
util3
/
cmpctplr.lha
/
CompactPlayer
/
Source
/
autoinit.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-12-28
|
2KB
|
126 lines
#include "sysheaders.h"
#include "compactplayer.h"
/*****************************************************************
* Autoinit functions
*/
extern Class *CreateCDPanelClass(void);
extern void DestroyCDPanelClass(Class *);
Class *CDPanelClass;
int __stdargs
_STI_999_cdpanel(void)
{
CDPanelClass = CreateCDPanelClass();
if (!CDPanelClass)
{
ErrorMsg(GS(CDPANEL_FAIL));
return -1;
}
return 0;
}
void __stdargs
_STD_999_cdpanel(void)
{
if (CDPanelClass)
DestroyCDPanelClass(CDPanelClass);
}
struct timerequest *TimerIO;
struct MsgPort *TimerPort;
struct Library *TimerBase;
int __stdargs
_STI_999_timer(void)
{
if (TimerPort = CreateMsgPort())
{
if (TimerIO = (struct timerequest *)CreateIORequest(TimerPort, sizeof(struct timerequest)))
{
if (!OpenDevice( "timer.device", UNIT_VBLANK, (struct IORequest *)TimerIO, NULL ))
{
TimerIO->tr_node.io_Command = TR_ADDREQUEST; /* initialize timer */
TimerIO->tr_time.tv_secs = 0;
TimerIO->tr_time.tv_micro = 10000;
SendIO((struct IORequest *)TimerIO);
TimerBase = TimerIO->tr_node.io_Device;
return 0;
}
DeleteIORequest((struct IORequest *)TimerIO);
TimerIO = NULL;
}
DeleteMsgPort(TimerPort);
TimerPort = NULL;
}
ErrorMsg(GS(TIMER_FAIL));
return -1;
}
void __stdargs
_STD_999_timer(void)
{
if (TimerIO)
{
if (TimerIO->tr_node.io_Command == TR_ADDREQUEST)
{
AbortIO(TimerIO);
WaitIO(TimerIO);
}
CloseDevice(TimerIO);
DeleteIORequest((struct IORequest *)TimerIO);
TimerIO = NULL;
}
if (TimerPort)
{
DeleteMsgPort(TimerPort);
TimerPort = NULL;
}
}
struct Library *LocaleBase;
int __stdargs
_STI_120_localization(void)
{
LocaleBase = OpenLibrary("locale.library", 38L);
OpenCompactPlayerCatalog(NULL,NULL);
return 0;
}
void __stdargs
_STD_120_localization(void)
{
CloseCompactPlayerCatalog();
if (LocaleBase)
CloseLibrary(LocaleBase);
}
void __stdargs
_STI_130_localizemenu(void)
{
struct NewMenu *menu = CompactMenu;
STRPTR s;
while (menu->nm_Type != NM_END)
{
if (menu->nm_Label != NM_BARLABEL)
{
s = GS((APTR)menu->nm_Label);
if (menu->nm_Type != NM_TITLE)
{
if (*s)
menu->nm_CommKey = s;
menu->nm_Label = s + 2;
if (menu->nm_UserData == NULL)
menu->nm_Flags = NM_ITEMDISABLED;
}
else
menu->nm_Label = s;
}
++menu;
}
}